from flask import Blueprint, render_template
from flask_restful import Api

from views.admin.admin_api import get_active_code, get_user_list_api, add_icode_api

admin_blueprint = Blueprint('admin_bp', __name__)

api = Api(admin_blueprint)

@admin_blueprint.route('/admin/list', endpoint="admin_list")
def admin_list_get():
    return render_template('./user/html/index.html')

@admin_blueprint.route('/root/code', endpoint="root_code")
def root_code_get():
    return render_template('./user/html/index.html')


# api.add_resource(对象, 'url')
api.add_resource(get_active_code, '/root/api/code')
api.add_resource(get_user_list_api, '/admin/api/list')
api.add_resource(add_icode_api, '/root/api/gen_code')
